function foodService($http) {

  var urlBase = "/api/food";

    var svc = this;

    function getAllFoods(){
        return $http.get(urlBase+"/getAllFood");
    }

    function addFood(food){
        return $http.post(urlBase+"/addFood",food,{
            transformRequest: angular.identity,
            headers: { "Content-Type": undefined }
        });
    }

    function getAllFoodByMerchantId(){
        return $http.get(urlBase+"/getAllFoodByMerchantId");
    }

    function delFoodByFoodId(foodId){
        return $http.get(urlBase+"/deleteFoodByFoodId/"+foodId);
    }

    function getFoodByFoodId(foodId){
        return $http.get(urlBase+"/getFoodByFoodId/"+foodId);
    }

    function modifyFoodByFoodId(food){
        return $http.post(urlBase+"/modifyFoodByFoodId",food,{
            transformRequest: angular.identity,
            headers: { "Content-Type": undefined }
        });
    }

    return {
        getAllFoods: getAllFoods,
        addFood : addFood,
        getAllFoodByMerchantId : getAllFoodByMerchantId,
        delFoodByFoodId:delFoodByFoodId,
        getFoodByFoodId:getFoodByFoodId,
        modifyFoodByFoodId:modifyFoodByFoodId
    }
}

module.exports = foodService;
